package edu.hncj.seckill.service.impl;

import edu.hncj.seckill.dao.UserPasswordMapper;
import edu.hncj.seckill.domain.UserPassword;
import edu.hncj.seckill.service.UserPasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author guochongling
 * @Date 2021/4/22 8:14 下午
 * @Version 1.0
 */
@Service
public class UserPasswordServiceImpl implements UserPasswordService {

    @Autowired
    UserPasswordMapper userPasswordMapper;

    /**
     * 插入密码
     *
     * @param userPassword 密码对象
     * @return 结果对象
     */
    @Override
    public int insertUserPassword(UserPassword userPassword) {
        return userPasswordMapper.insert(userPassword);
    }

    /**
     * 更新免密
     *
     * @param userPassword 密码对象
     * @return 结果对象
     */
    @Override
    public int updateUserPasswordByUserId(UserPassword userPassword) {
        return userPasswordMapper.updateByPrimaryKey(userPassword);
    }

    /**
     * 根据用户ID查询密码
     *
     * @param user_id@return 结果对象
     */
    @Override
    public UserPassword selectByUserId(String user_id) {
        return userPasswordMapper.selectByUserId(user_id);
    }
}
